package com.xjd.edu.user.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xjd.edu.user.dao.shop.ShopTypeDao;
import com.xjd.edu.user.dao.user.UserDao;
import com.xjd.edu.user.entity.ShopType;
import com.xjd.edu.user.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class Demo {

    @Autowired
    ShopTypeDao shopTypeDao;

    @Autowired
    UserDao userDao;

    @GetMapping("/user/demo")
    public Map<String, List<Object>> demo(){
        List<ShopType> shopTypes = shopTypeDao.selectList(new QueryWrapper<>());
        List<User> users = userDao.selectList(new QueryWrapper<>());
        Map<String, List<Object>> map = new HashMap<>();
        map.put("shopTypes", Collections.singletonList(shopTypes));
        map.put("users", Collections.singletonList(users));
        //return Map.of("shopTypes", shopTypes, "users", users);
        return map;
    }
}
